Hi anda_skoa,
Since I am a newbie to Qt, I do not know how to use QFile + QTextStream.
I have written a small program like:
#include <iostream>
#include <string>
#include <map>
typedef double qreal;
struct QSimplexVariable
{
QSimplexVariable() : result(0), index(0) {}
qreal result;
int index;
};
struct QSimplexConstraint
{
QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {}
enum Ratio {LessOrEqual = 0,Equal,MoreOrEqual};
float constant;
Ratio ratio;
std::pair<QSimplexVariable *, qreal> helper;
QSimplexVariable * artificial;
};
QSimplexConstraint parseMe(const std::string& str)
{
return QSimplexConstraint() ; // I should fill some thing more here to parse the string as a QsimplexConstraint.
}
using namespace std;
int main()
{
std::string constraintString;
cout << "Enter a constraint string: ";
getline(cin, constraintString);
QSimplexConstraint qc = parseMe( constraintString );
//...
}
#include <iostream>
#include <string>
#include <map>
typedef double qreal;
struct QSimplexVariable
{
QSimplexVariable() : result(0), index(0) {}
qreal result;
int index;
};
struct QSimplexConstraint
{
QSimplexConstraint() : constant(0), ratio(Equal), artificial(0) {}
enum Ratio {LessOrEqual = 0,Equal,MoreOrEqual};
float constant;
Ratio ratio;
std::pair<QSimplexVariable *, qreal> helper;
QSimplexVariable * artificial;
};
QSimplexConstraint parseMe(const std::string& str)
{
return QSimplexConstraint() ; // I should fill some thing more here to parse the string as a QsimplexConstraint.
}
using namespace std;
int main()
{
std::string constraintString;
cout << "Enter a constraint string: ";
getline(cin, constraintString);
QSimplexConstraint qc = parseMe( constraintString );
//...
}
To copy to clipboard, switch view to plain text mode
Could you please help me to complete my code from here.
Thanks,
Navy1991.
Bookmarks